<?php
namespace Admin\Controller;
use Think\Controller;

class SystemController extends CommonController
{
    protected $sys;
    protected $Sys;
    public function __construct()
    {
        parent::__construct();
        $this->Sys = M('Systeminfo');
        $this->sys =$this->Sys->find(1);
        $this->assign('sys',$this->sys);
    }

    public function changepassword(){

        $this->display();
    }

    public function do_change(){
       $System = D('System');
        //dump($System);
        if(!$System->create()){
        $this->error($System->getError());
        }else{
            //dump($System->create());
            //exit();
             $System->save();
             $this->success('修改密码成功',U('User/login'));
}

       /* $System = D("System"); // 实例化User对象
        $userData = $System->getUserData(); // 通过方法获取用户数据
        dump($userData);


        $System->create($userData,2); // 根据userData数据创建数据对象，并指定为更新数据
        $System->add();*/
    }


    public function systeminfo(){
//dump($this->sys);
        $this->display();
}

    public function systemchange(){


        dump( $_POST['owner']);
        $arr = $this->Sys->create();
        dump($arr);
        //exit();
        //$this->Sys->id=1;在静态页面隐藏添加id；
        $this->Sys->save();
        $this->success("修改系统信息成功",U('systeminfo'));
    }

    public function clear_cache(){
        delDir(RUNTIME_PATH);
        $this->success('清除成功');
    }
}